home *** CD-ROM | disk | FTP | other *** search
/ 3D GFX / 3D GFX.iso / amiutils / u_z / visual / rexx / imagefx.rexx next >
OS/2 REXX Batch file  |  1995-12-30  |  2KB  |  108 lines

  1. /*
  2.  * $VER: 1.00 (2-mar-1995)
  3.  *
  4.  * Arexx program for Visual to generate thumbnails with ImageFX.
  5.  * Written by C.Vallee
  6.  *
  7.  * This script generates thumbnails for all the selected file
  8.  *
  9.  */
  10.  
  11. options results
  12. gfxport = IMAGEFX.1
  13.  
  14. /* Loading ImageFX, if not present */
  15.  
  16. if (~show('p',gfxport)) then do
  17.    message "Loading ImageFX..."
  18.    address command "run ImageFX:ImageFX Iconify"
  19.    message "Waiting for the "||gfxport||" ARexx port..."
  20.  
  21. /* Waiting for the ARexx port every 2 seconds until present */
  22.    do while (~show('p','IMAGEFX.1'))
  23.       address command "Wait 2"
  24.       check
  25.       if rc ~= 0 then exit
  26.    end
  27. end
  28.  
  29. GetInfo
  30. parse var result '"' mypalette '"' w h .
  31.  
  32. address value gfxport
  33.  
  34. Redraw Off
  35. Undo Off
  36.  
  37. Render Mode Hires Lace Ham
  38. Render Colors 64
  39.  
  40. LockRange 0 Off
  41. Palette 8
  42. LoadPalette '"'mypalette'"' '-1'
  43. LockRange 0 On
  44.  
  45. address
  46.  
  47. do forever
  48.    check
  49.    if rc ~= 0 then break
  50.  
  51.    getselected
  52.    if result = "" then break
  53.    file = result
  54.  
  55.    i = LASTPOS('/', file)
  56.    IF i = 0 THEN i = LASTPOS(':', file)
  57.    name = substr( file , i+1 )
  58.  
  59.    message 'Loading "'||name||'"...' 
  60.  
  61.    address
  62.    LoadBuffer '"'file'"' Force NoSmooth
  63.  
  64.    if rc = 0 then do
  65.       GetMain
  66.       parse var result . width height .
  67.  
  68.       if ( width * h ) > (height * w ) then do
  69.          height = ( height * w ) % width
  70.          width = w
  71.       end
  72.       else do
  73.          width = ( width * h ) % height
  74.          height = h
  75.       end
  76.  
  77.       address VISUAL message 'Scaling "'||name||'"...'
  78.  
  79.       Scale width height
  80.       Grey2Color
  81.  
  82.       address VISUAL message 'Rendering "'||name||'"...'
  83.  
  84.       Render Go
  85.  
  86.       SaveRenderedAs ILBM '"'file'.icn"'
  87.  
  88.       Render Close
  89.     
  90.       KillBuffer Force
  91.  
  92.       address
  93.       update
  94.       end
  95.    else do
  96.       address
  97.       unselect
  98.    end
  99. end
  100.  
  101. address
  102.  
  103. Undo On
  104. Redraw On
  105.  
  106. /* Quit ImageFX */
  107. Quit force
  108.